﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Reporting.WebForms;
using System.Data;
using System.Data.SqlClient;
using Maticsoft.DBUtility;

public partial class ReportB : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnViewReport_Click(object sender, EventArgs e)
    {
        try
        {
            this.ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
            LocalReport localReport = ReportViewer1.LocalReport;
            localReport.ReportPath = "Reports/Emp3/ReportB.rdlc";
            localReport.DataSources.Clear();

            // 所属指挥中心
            DataSet ds1 = new DataSet();
            SqlParameter[] para1 = {         };
            ds1 = DbHelperSQL.ExecProc("uspEmp3ReportB1", para1);
            ReportDataSource rds1 = new ReportDataSource();
            rds1.Name = "DataSet1";
            rds1.Value = ds1.Tables[0];
            localReport.DataSources.Add(rds1);

            //城市
            DataSet ds2 = new DataSet();
            SqlParameter[] para2 = {    };
            ds2 = DbHelperSQL.ExecProc("uspEmp3ReportB2", para2);
            ReportDataSource rds2 = new ReportDataSource();
            rds2.Name = "DataSet2";
            rds2.Value = ds2.Tables[0];
            localReport.DataSources.Add(rds2);

            //入职年限
            DataSet ds3 = new DataSet();
            SqlParameter[] para3 = { };
            ds3 = DbHelperSQL.ExecProc("uspEmp3ReportB3", para3);
            ReportDataSource rds3 = new ReportDataSource();
            rds3.Name = "DataSet3";
            rds3.Value = ds3.Tables[0];
            localReport.DataSources.Add(rds3);

            //职级
            DataSet ds4 = new DataSet();
            SqlParameter[] para4 = { };
            ds4 = DbHelperSQL.ExecProc("uspEmp3ReportB4", para4);
            ReportDataSource rds4 = new ReportDataSource();
            rds4.Name = "DataSet4";
            rds4.Value = ds4.Tables[0];
            localReport.DataSources.Add(rds4);

            //部门
            DataSet ds5 = new DataSet();
            SqlParameter[] para5 = { };
            ds5 = DbHelperSQL.ExecProc("uspEmp3ReportB5", para5);
            ReportDataSource rds5 = new ReportDataSource();
            rds5.Name = "DataSet5";
            rds5.Value = ds5.Tables[0];
            localReport.DataSources.Add(rds5);

            //品牌
            DataSet ds6 = new DataSet();
            SqlParameter[] para6 = { };
            ds6 = DbHelperSQL.ExecProc("uspEmp3ReportB6", para6);
            ReportDataSource rds6 = new ReportDataSource();
            rds6.Name = "DataSet6";
            rds6.Value = ds6.Tables[0];
            localReport.DataSources.Add(rds6); 

            ReportViewer1.LocalReport.Refresh();

        }
        catch (Exception ex)
        {

            throw;
        }
    }
}